let arr = [1,2,3,4,5,6]



Array.prototype.my_reduce = function(fc,...x){
    index=0;
    if(x.length){
        per= this[0]
    }
       per = x
    for(let i=0;i<this.length;i++){
        per= fc(per,this[i],i,this)
        
    }
    return per
}

const res =arr.my_reduce((per,item,index,arr)=>{
    return per+item
})
console.log(res);
console.log(1);

